<template>
	<div class="shoppjbox">
		<div class="orderpjxq-content" v-for="item in lylist">
			<ul class="orderpjxq-title">
				<li class="orderpjxq-user-photo"><img :src="'http://www.ntyouxuan.com/'+item.portrait"/></li>
				<li class="orderpjxq-user-xinxi">
					<p v-text="item.buyer_name"></p>
					<span v-text="item.evaluation_time"></span>
				</li>
				<li class="orderpjxq-user-pj">
					<span v-if="item.evaluation==3"><img src="../../img-order/haoping_btn@3x.png"/></span>
					<span v-if="item.evaluation==3">好评</span>
					<span v-if="item.evaluation==2"><img src="../../img-order/zhongping_btn@3x.png"/></span>
					<span v-if="item.evaluation==2">中评</span>
					<span v-if="item.evaluation==1"><img src="../../img-order/chaping_btn@3x.png"/></span>
					<span v-if="item.evaluation==1">差评</span>
				</li>
			</ul>
			<div class="orderpjxq-zitu">
				<p v-text="item.comment"></p>
				<div class="orderpjxq-photo" v-if="item.evaluation_image">
					<span v-for="itemimg in item.evaluation_image"><img :src="'http://www.ntyouxuan.com/'+itemimg"/></span>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default{
		name:'shoppj',
		data () {
			return{
				lylist:[],
				page:1,
				pagenum:0,
				scrollstatu:true
			}
		},
		props:['msg'],
		created:function(){
			
		},
		methods:{
			ajaxpj:function(){
				var self=this;
				$.ajax({
					type:"post",
					url:furl+"index.php?app=ajax_buyer_order&act=comments",
					data:{'goods_id':self.msg,'page':self.page},
					dataType:'json',
					success:function(res){
						if(res.done){
							for(var i=0;i<res.retval.comments.length;i++){
								res.retval.comments[i].evaluation_time=new Date(Number(res.retval.comments[i].evaluation_time)*1000).Format('yyyy-MM-dd hh:mm:ss');
								self.lylist.push(res.retval.comments[i]);
								self.pdnm = res.retval.comments[i].anonymous;
								if (self.pdnm == 1) {
									$('#apppp').css("display","none")
								}
							};
							self.pagenum=res.retval.page_info.page_count;
							if(self.pagenum != 0){
								$("#kong").css("display","none")
							}
						};
					}
				});
			},
			scrollajax:function(){
				
				if(this.scrollstatu){
					if(this.page+1<=this.pagenum){
						var dSH=$(document).scrollTop()
						var dH=$(document).height()
						var wH=$(window).height()
						if((dSH+wH)/dH>0.8){
							this.scrollstatu=false;
							this.page=this.page+1;
							this.ajaxpj();
						}
					}
					
				}
			}
		},
		mounted:function(){
			this.ajaxpj();
			var self=this;
			window.addEventListener('scroll',self.scrollajax);
		},
		destroyed:function () {
		    this.scrollstatu = false;
		}
	}
</script>

<style>
.shoppjbox{font-size:0;padding-bottom: 1rem;min-height:100%;}
.orderpjxq-content{
	padding-left:0.32rem;
	padding-right:0.32rem;
	background-color:#fff;
	margin-bottom: 0.16rem;
}
.orderpjxq-title{
	border-bottom: 1px solid #eee;
	height:1.64rem;
	box-sizing: border-box;
	padding-top: 0.32rem;
	padding-bottom:0.32rem;
}
.orderpjxq-title>li{
	display: inline-block;
	height:1rem;
}
.orderpjxq-user-photo{
	float:left;
}
.orderpjxq-user-photo>img{
	width:1rem;
	height:1rem;
}
.orderpjxq-user-xinxi{
	width:4.52rem;
	box-sizing: border-box;
	padding-left: 0.26rem;
}
.orderpjxq-user-xinxi>p{
	font-size:0.32rem;
	color:#2e2e2e;
	line-height: 0.62rem;
}
.orderpjxq-user-xinxi>span{
	font-size:0.24rem;
	color:#A3A5A7;
	margin-right: 0.32rem;
	margin-top: 0.05rem;
}
.orderpjxq-user-pj{
	float:right;
}
.orderpjxq-user-pj>span>img{
	width:0.5rem;
	height:0.5rem;
	margin-right: 0.2rem;
	float:left;
	margin-top: 0.24rem;
}
.orderpjxq-user-pj>span:nth-child(2){
	font-size:0.32rem;
	color:#2b2b2b;
	line-height: 1rem;
}
.orderpjxq-zitu>p{
	font-size:0.32rem;
	color:#2b2b2b;
	line-height: 0.48rem;
	padding-top: 0.32rem;
	padding-bottom: 0.32rem;
}
.orderpjxq-photo>span{
	display: inline-block;
	width:1.2rem;
	box-sizing: border-box;
	height:1.2rem;
	margin-right: 0.5rem;
	margin-bottom: 0.32rem;
}
.orderpjxq-photo>span>img{
	width:1.2rem;
	height:1.2rem;
}
.orderpjxq-photo>span:nth-child(4n){
	margin-right: 0;
}

</style>